// sdetail.js
var app = getApp();
var order = ['red', 'yellow', 'blue', 'green', 'red']
Page({
  data: {
    toView: 'red',
    scrollTop: 100
  },
  //门店照片
  list2: function (sort, id, that) {
    var url = app.data.url
    wx.request({
      url: '' + url + '/shop/goods/getlist3',
      data: { sort: 1, membersellerid: id },
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        that.setData({
          list2: res.data.Rows
        })
      },
      error: function (res) {
        console.log(res)
      }
    })
  },
  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
    var id = options.id;
    var that = this;
    var url = app.data.url;
    wx.request({
      //头部信息接口
      url: '' + url + '/shop/index/GetLogo',
      data: { id: id },
      header: {
        'Content-Type': 'application/json'
      },
      success: function (res) {
        console.log(res.data + '1111')
        that.setData({
          list: res.data.Rows
        })
      },
      error: function (res) {
        console.log(res)
      }
    });
    //门店照片
    that.setData({
      id: id
    })
    that.list2(1, id, that);
  },
  upper: function(e) {
    console.log(e)
  },
  lower: function(e) {
    console.log(e)
  },
  scroll: function(e) {
    console.log(e)
  },
  tap: function(e) {
    for (var i = 0; i < order.length; ++i) {
      if (order[i] === this.data.toView) {
        this.setData({
          toView: order[i + 1]
        })
        break
      }
    }
  },
  tapMove: function(e) {
    this.setData({
      scrollTop: this.data.scrollTop + 10
    })
  }
})